package com.mdd.front.validate.goods;

import com.mdd.common.validator.annotation.IDMust;
import com.mdd.common.validator.annotation.IntegerContains;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 订单服务参数
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class OrderGoodsParam implements Serializable {

    private static final long serialVersionUID = 1L;

    public interface create{}
    public interface update{}
    public interface delete{}

    @IDMust(message = "id参数必传且需大于0", groups = {update.class, delete.class})
    private Long id;

    @NotNull(message = "orderId参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "orderId参数值不能少于0", groups = {create.class, update.class})
    private Long orderId;

    @NotNull(message = "goodsId参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "goodsId参数值不能少于0", groups = {create.class, update.class})
    private Long goodsId;

    @NotNull(message = "goodsName参数缺失", groups = {create.class, update.class})
    @Length(max = 64, message = "goodsName参数不能超出64个字符", groups = {create.class, update.class})
    private String goodsName;

    @NotNull(message = "unitName参数缺失", groups = {create.class, update.class})
    @Length(max = 255, message = "unitName参数不能超出255个字符", groups = {create.class, update.class})
    private String unitName;

    @NotNull(message = "goodsNum参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "goodsNum参数值不能少于0", groups = {create.class, update.class})
    private Integer goodsNum;

    @NotNull(message = "goodsPrice参数缺失", groups = {create.class, update.class})
    private BigDecimal goodsPrice;

    @NotNull(message = "totalPrice参数缺失", groups = {create.class, update.class})
    private BigDecimal totalPrice;

    @NotNull(message = "totalPayPrice参数缺失", groups = {create.class, update.class})
    private BigDecimal totalPayPrice;

    @NotNull(message = "isComment参数缺失", groups = {create.class, update.class})
    @IntegerContains(values = {0, 1}, message = "isComment参数值不在符合范围", groups = {create.class, update.class})
    private Integer isComment;

    private String goodsSnap;

}
